package com.lanou.myim.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.lanou.myim.R;
import com.lanou.myim.tools.ParseSingleton;
import com.parse.ParseObject;

import java.util.List;

/**
 * Created by dllo on 16/3/23.
 */
public class SetGroupAdapter extends BaseAdapter {
    private Context context;
    private List<String> list;

    public SetGroupAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        if (list != null) {
            return list.size();
        } else {
            return 0;
        }
    }

    @Override
    public Object getItem(int i) {
        if (list != null) {
            return list.get(i);

        } else {
            return null;
        }
    }

    @Override
    public long getItemId(int i) {
        if (list != null) {
            return i;
        } else {
            return 0;
        }
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder = null;
        view = LayoutInflater.from(context).inflate(R.layout.set_iv, null);
        viewHolder = new ViewHolder();
        viewHolder.imageView = (ImageView) view.findViewById(R.id.set_iv);
        view.setTag(viewHolder);

        ParseSingleton.setBitmap(list.get(position), viewHolder.imageView);


        return view;
    }


    private class ViewHolder {
        public ImageView imageView;

    }


}
